use serde::Serialize;
pub mod state_code;
pub mod user;
pub mod user_token;

/// 应答对象
#[derive(Serialize)]
pub struct Response<T>
where
    T: Serialize,
{
    /// 应答的状态码
    #[serde(rename = "Code")]
    code: i32,
    /// 应答的消息
    #[serde(rename = "Message")]
    message: String,
    /// 应答的结果数据
    #[serde(rename = "Data")]
    data: Option<T>,
}

impl<T> Response<T>
where
    T: Serialize,
{
    /// 新建应答对象
    pub fn new(code: i32, message: String, data: Option<T>) -> Response<T> {
        Response {
            code,
            message,
            data,
        }
    }
}
